import { useRouter, useRoute } from "vue-router";

function routerFn() {
  const router = useRouter();
  const route = useRoute();

  const routerObj = {
    router,
    route,
    push: (url) => {
      router.push(url);
    },
    replace: (url) => {
      router.replace(url);
    },
    back: () => {
      router.go(-1);
    },
    go: (delta) => {
      router.go(delta);
    },
  };
  return routerObj;
}

export default routerFn;
